import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import "bootstrap/dist/css/bootstrap.css"
import ElementPlus from 'element-plus'  //引入element-plus库
import VForm3 from 'vform3-builds'  //引入VForm3库
import zhCn from "element-plus/es/locale/lang/zh-cn";
import 'element-plus/dist/index.css'  //引入element-plus样式
import 'vform3-builds/dist/designer.style.css'  //引入VForm3样式
import i18n from "./locals"
import Emitter from "tiny-emitter"
const app = createApp(App)
const permissionArray = ['role.manager','config.manager']
import router from "./route"
import axios from './axios'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
app.directive('hasPermission',{
    mounted(el,binding){
        const value = binding.value;
        let bRst = permissionArray.some((item)=>{
            return item === value
        })
        if(!bRst){
            el.parentNode && el.parentNode.removeChild(el)
        }
    }
})
app.use(ElementPlus,{locale:zhCn})
app.use(VForm3)
app.use(i18n)
// app.use(Emitter)
app.config.globalProperties.$bus=new Emitter()
app.use(router)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
window.http = axios;
app.mount('#app')
